package demo7;

/**
 * @author Huangjin
 * @version 1.0
 * describe:
 * @date 2023/2/28 17:35
 */
public class IndexOfDemo {
    public static void main(String[] args) {
        String str = "我表示很喜欢java的编程思想";
        int index = str.indexOf("ja");
        System.out.println(index);
        index = str.indexOf("ja",0);
        System.out.println(index);
        index = str.indexOf("abc");
        System.out.println(index);
        index = str.lastIndexOf("ja");
        System.out.println(index);

        String str1 = "thinking in java";
        int index1 = str.indexOf("ja");
        System.out.println(index1);
        index1 = str.indexOf("in",6);
        System.out.println(index1);
        index1 = str.indexOf("abc");
        System.out.println(index1);
        index1 = str.lastIndexOf("in");
        System.out.println(index1);
    }
}
